package com.lyl.myaiagent.rag.local;

import jakarta.annotation.Resource;
import org.springframework.ai.document.Document;
import org.springframework.ai.embedding.EmbeddingModel;
import org.springframework.ai.vectorstore.SimpleVectorStore;
import org.springframework.ai.vectorstore.VectorStore;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.List;

/**
 * @author lyl
 * @version 1.0
 * @CreateTime: 2025-08-19
 */
//@Configuration
public class PROVectorStoreConfig {
    @Resource
    private MarkDownsLoader markDownsLoader;

    @Bean
    VectorStore proVectorStore(EmbeddingModel dashscopeEmbeddingModel){
        SimpleVectorStore simpleVectorStore = SimpleVectorStore.builder(dashscopeEmbeddingModel)
                .build();
        List<Document> documents = markDownsLoader.loadMarkDowns();
        simpleVectorStore.add(documents);
        return simpleVectorStore;
    }
}
